package com.tangpian.framework.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.ElementCollection;
import javax.persistence.Embeddable;

@Embeddable
public class Account {
	private String username;

	private String password;

	private boolean rememberMe;

	@ElementCollection
	private Set<Role> roles = DEFAULT_ROLE;
	
	private static final Set<Role> DEFAULT_ROLE = new HashSet<Role>();
	
	static {
		DEFAULT_ROLE.add(Role.USER);
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public boolean isRememberMe() {
		return rememberMe;
	}

	public void setRememberMe(boolean rememberMe) {
		this.rememberMe = rememberMe;
	}

	public Set<Role> getRoles() {
		return roles;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}

}
